[##include file="common/header.tpl.php"##]
[##include file="common/nav.tpl.php"##]


<div id="main">
	<p><a href="[##$adminurl##]/?m=factory&a=eventadd">添加事件</a></p>

	<table class="gridView" style="margin-top:20px;">
		<thead>
			<tr>
				<td style="width:35px">ID</td>
				<td>事件名</td>
				<td style="width:110px">地点</td>
				<td style="width:60px">修改人</td>
				<td style="width:145px">最后修改时间</td>
				<td style="width:80px">操作</td>
			</tr>
		</thead>
		[##foreach from=$event_list item=event##]
		<tr id="event_[##$event.id##]">
			<td>[##$event.id##]</td>
			<td id="event_name_[##$event.id##]">[##$event.name|escape##]</td>
			<td>[##$event.place_name##]</td>
			<td>[##$event.uin##]</td>
			<td>[##$event.time|formatTime:'Y-m-d H:i:s'##]</td>
			<td>
				<a href="[##$adminurl##]/?m=factory&a=eventadd&id=[##$event.id##]">编辑</a>
				| 
				<a href="#" onclick="delete_event([##$event.id##]); return false;">删除</a>
			</td>
		</tr>
		[##/foreach##]
	</table>
</div>

<script type="text/javascript">
function delete_event(id) {
	var name = $('#event_name_' + id).text();
	if( confirm('确定要删除《' + name + '》吗？') ) {
		var submit_url = '[##$adminurl##]/?m=factory&a=eventdelete';
		$.post(submit_url , {'event_id' : id} , function(d) {
			if(d.code) return alert(d.msg);

			alert(d.msg);
			$('#event_' + id).fadeOut();
		} , 'json');
	}
}
</script>

[##include file="common/footer.tpl.php"##]